/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.controller;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.poi.xwpf.usermodel.Borders;
import org.apache.poi.xwpf.usermodel.BreakClear;
import org.apache.poi.xwpf.usermodel.BreakType;
import org.apache.poi.xwpf.usermodel.LineSpacingRule;
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
import org.apache.poi.xwpf.usermodel.TextAlignment;
import org.apache.poi.xwpf.usermodel.UnderlinePatterns;
import org.apache.poi.xwpf.usermodel.VerticalAlign;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.hibernate.SessionFactory;
import queenb.net.entitybean.M650;
import queenb.web.store.M650Store;
import queenb.web.util.ResourcesProvider;
import queenb.web.util.SessionProvider;
import org.apache.poi.hwpf.usermodel.*;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hpsf.DocumentSummaryInformation;
import org.apache.poi.hwpf.*;
import org.apache.poi.hwpf.extractor.*;
import org.apache.poi.hwpf.usermodel.HeaderStories;
import queenb.net.entitybean.N100;
import queenb.web.store.EmployeeStore;
import queenb.web.util.Util;

/**
 *
 * @author ems
 */
public class DocumentController extends QueenbController {

    private int pn100;
    private int pm650;
    private String avata;
    private String flag = "none";
    private List<M650> listdocument = new ArrayList<M650>();
    private String table;
    private boolean add = false;
    private boolean edit = false;
    private boolean delete = false;
    private String active = "";
    private int fv050;
    private String fv051;
    private int fs200;
    private int fk350;
    private String readFile;// content file Word
    private EmployeeStore employeeStore;
    private Date nd353p;

    public DocumentController() {
        Object pnPN100 = getRequest().getParameter("id");
        Object action = getRequest().getParameter("action");
        System.out.println("------id------------------" + pnPN100);
        Object pnPM650 = getRequest().getParameter("pm650");
        Object pvtable = getRequest().getParameter("table");
        Object pvpage = getRequest().getParameter("page");
        Object objFS200 = getRequest().getParameter("fs200");
        Object objFV050 = getRequest().getParameter("fv050");


        if (objFS200 != null) {
            this.fs200 = Integer.parseInt(objFS200.toString());

        }
        if (objFV050 != null) {
            this.fv050 = Integer.parseInt(objFV050.toString());
            SessionProvider.setSessionMapValue("fv050D", objFV050);
        }
        if (pnPN100 != null) {
            SessionProvider.setSessionMapValue("fk350D", pnPN100);
        }
        if (pvtable != null) {
            table = pvtable.toString();
        }
        if (pvpage != null && pvpage.toString().contains("employee.jsp")) {
            table = "N100";
        }
        if (pvpage != null && pvpage.toString().contains("supplier.jsp")) {

            table = "K100";
            System.out.println("tungggggggggggggggggggggg------------" + table);
        }
        if (pvpage != null && pvpage.toString().contains("partner.jsp")) {
            table = "K100";
        }
        if (pvpage != null && pvpage.toString().contains("customer.jsp")) {
            table = "N100";
        }
        if (pvpage != null && pvpage.toString().contains("cuscompany.jsp")) {
            table = "K100";
        }
        System.out.println("---->+table" + table);

        if (pnPN100 != null && !pnPN100.toString().isEmpty()) {
            pn100 = Integer.parseInt(pnPN100.toString());
        }
        // set right upload document
        if (pvpage != null && pvpage.toString().equals("customer.jsp")) {
            if (getLoginSession().getRight().isCUS_DOC_CRE()) {
                add = true;
            }
            if (getLoginSession().getRight().isCUS_DOC_MOD()) {
                edit = true;
            }
            if (getLoginSession().getRight().isCUS_DOC_DEL()) {
                delete = true;
            }

        } else if (pvpage != null && pvpage.toString().equals("cuscompany.jsp")) {
            if (getLoginSession().getRight().isCOM_DOC_CRE()) {
                add = true;
            }
            if (getLoginSession().getRight().isCOM_DOC_MOD()) {
                edit = true;
            }
            if (getLoginSession().getRight().isCOM_DOC_DEL()) {
                delete = true;
            }
        } else if (pvpage != null && pvpage.toString().equals("employee.jsp")) {
            if (getLoginSession().getRight().isEMP_DOC_CRE()) {
                add = true;
            }
            if (getLoginSession().getRight().isEMP_DOC_MOD()) {
                edit = true;
            }
            if (getLoginSession().getRight().isEMP_DOC_DEL()) {
                delete = true;
            }
        } else if (pvpage != null && pvpage.toString().equals("supplier.jsp")) {
            if (getLoginSession().getRight().isSUP_DOC_CRE()) {
                add = true;
            }
            if (getLoginSession().getRight().isSUP_DOC_MOD()) {
                edit = true;
            }
            if (getLoginSession().getRight().isSUP_DOC_DEL()) {
                delete = true;
            }
        } else if (pvpage != null && pvpage.toString().equals("partner.jsp")) {
            if (getLoginSession().getRight().isPAR_DOC_CRE()) {
                add = true;
            }
            if (getLoginSession().getRight().isPAR_DOC_MOD()) {
                edit = true;
            }
            if (getLoginSession().getRight().isPAR_DOC_DEL()) {
                delete = true;
            }
        }else if (pvpage != null && pvpage.toString().equals("employeenew.jsp")) {
            if (getLoginSession().getRight().isPAR_DOC_CRE()) {
                add = true;
            }
            if (getLoginSession().getRight().isPAR_DOC_MOD()) {
                edit = true;
            }
            if (getLoginSession().getRight().isPAR_DOC_DEL()) {
                delete = true;
            }
        }
    }

    /**
     * @return the pn100
     */
    public int getPn100() {
         if(pn100==0){
           if(SessionProvider.getSessionMapValue("PN100HD")!=null){
                pn100 = Util.parseInt(SessionProvider.getSessionMapValue("PN100HD"));
            }
        }
        return pn100;
    }

    /**
     * @param pn100 the pn100 to set
     */
    public void setPn100(int pn100) {
        this.pn100 = pn100;
    }

    /**
     * @return the pm650
     */
    public List<M650> getDocumentAll() {
        try {
            System.out.println("ERROR DOCUMENT============ : " + table);
            if (table == null) {
                table = "N100";
            }
            M650Store attachmentStore = new M650Store();
            List<M650> listM650 = attachmentStore.findM650(7, 99, 0, null, 0, 0, 0, null, table, 0, pn100, null, null, 0, 10000, 0, 0, getLogin().getUserName());
            return listM650;
        } catch (Exception ex) {
            System.out.println("ERROR DOCUMENT : " + ex.getMessage());
            return null;
        }

    }

    public int getPm650() {
        System.out.println("------------------------->> getPm650 is called !");
        M650Store attachmentStore = new M650Store();
        avata = "../images/avatar2.jpg";
        setListdocument(new ArrayList<M650>());
        System.out.println("size of list....." + getLoginSession().getLogin().getModule());
        try {
            if (SessionProvider.getSessionMapValue("PN100HD") != null) {
                pn100 = Util.parseInt(SessionProvider.getSessionMapValue("PN100HD"));
            }
            setListdocument(attachmentStore.findM650(getLoginSession().getLogin().getModule(), getLoginSession().getLogin().getCompanyNo(), 0, null, 0, 0, 0, null, table, fv050, pn100, null, null, 0, 10000, 0, 0, getLoginSession().getLogin().getUserName()));
            System.out.println("size of list......." + getListdocument().size());

        } catch (Exception e) {
            System.out.println("error database" + e.getMessage());
        }
        return pm650;
    }

    /**
     * @param pm650 the pm650 to set
     */
    public void setPm650(int pm650) {
        this.pm650 = pm650;
    }

    /**
     * @return the avata
     */
    public String getAvata() {

        return avata;
    }

    /**
     * @param avata the avata to set
     */
    public void setAvata(String avata) {
        this.avata = avata;
    }

    /**
     * @return the listdocument
     */
    public List<M650> getListdocument() {
        try {
            M650Store attachmentStore = new M650Store();
            if (SessionProvider.getSessionMapValue("PN100HD") != null) {
                pn100 = Util.parseInt(SessionProvider.getSessionMapValue("PN100HD"));
            }
            setListdocument(attachmentStore.findM650(getLoginSession().getLogin().getModule(), getLoginSession().getLogin().getCompanyNo(), 0, null, 0, 0, 0, null, table, fv050, pn100, null, null, 0, 10000, 0, 0, getLoginSession().getLogin().getUserName()));
        } catch (Exception e) {
        }
        if (listdocument.size() > 0) {
            setFlag("block");
        }
        System.out.println("-------size document " + listdocument.size());
        return listdocument;
    }

    /**
     * @param listdocument the listdocument to set
     */
    public void setListdocument(List<M650> listdocument) {
        this.listdocument = listdocument;
    }

    /**
     * @return the flag
     */
    public String getFlag() {
        return flag;
    }

    /**
     * @param flag the flag to set
     */
    public void setFlag(String flag) {
        this.flag = flag;
    }

    /**
     * @return the add
     */
    public boolean isAdd() {
        return add;
    }

    /**
     * @param add the add to set
     */
    public void setAdd(boolean add) {
        this.add = add;
    }

    /**
     * @return the edit
     */
    public boolean isEdit() {
        return edit;
    }

    /**
     * @param edit the edit to set
     */
    public void setEdit(boolean edit) {
        this.edit = edit;
    }

    /**
     * @return the delete
     */
    public boolean isDelete() {
        return delete;
    }
    
     public List<M650> getListdocumentCus() {
        try {
            M650Store attachmentStore = new M650Store();
            if (SessionProvider.getSessionMapValue("PN100HD") != null) {
                pn100 = Util.parseInt(SessionProvider.getSessionMapValue("PN100HD"));
            }
            setListdocument(attachmentStore.findM650(getLoginSession().getLogin().getModule(), getLoginSession().getLogin().getCompanyNo(), 0, null, 0, 0, 0, null, "K100", fv050, pn100, null, null, 0, 10000, 0, 0, getLoginSession().getLogin().getUserName()));
        } catch (Exception e) {
        }
        if (listdocument.size() > 0) {
            setFlag("block");
        }
        System.out.println("-------size document " + listdocument.size());
        return listdocument;
    }

    /**
     * @param delete the delete to set
     */
    public void setDelete(boolean delete) {
        this.delete = delete;
    }

    /**
     * @return the fv050
     */
    public int getFs200() {
        return fs200;
    }

    /**
     * @param fv050 the fv050 to set
     */
    public void setFs200(int fs200) {
        this.fs200 = fs200;
    }

    /**
     * @return the active
     */
    public String getActive() {
        return active;
    }

    /**
     * @param active the active to set
     */
    public void setActive(String active) {
        this.active = active;
    }

    /**
     * @return the fv050
     */
    public int getFv050() {
        return fv050;
    }

    /**
     * @param fv050 the fv050 to set
     */
    public void setFv050(int fv050) {
        this.fv050 = fv050;
    }

    /**
     * @return the fk350
     */
    public int getFk350() {
        return fk350;
    }

    /**
     * @param fk350 the fk350 to set
     */
    public void setFk350(int fk350) {
        this.fk350 = fk350;
    }

    /**
     * @return the fv051
     */
    public String getFv051() {
        return fv051;
    }

    /**
     * @param fv051 the fv051 to set
     */
    public void setFv051(String fv051) {
        this.fv051 = fv051;
    }

    public void printWord() {
        
        String s = getRequest().getRequestURL().toString();
        String[] arr = new String[20];
        arr = s.split("/");
        String url = "";
        if (arr.length > 3) {
            url = arr[0] + "/" + arr[1] + "/" + arr[2] + "/";
        }

        employeeStore = new EmployeeStore();
        if (SessionProvider.getSessionMapValue("PN100HD") != null) {
            pn100 = Util.parseInt(SessionProvider.getSessionMapValue("PN100HD"));
        }
        System.out.println("VAO DAY ko---------------------------------"+getLogin().getModule()+","+ getLogin().getCompanyNo()+","+ pn100+","+ getLogin().getUserName());
        List<N100> listHD = employeeStore.getNCURPKS_LISTOFTABN100NHD(getLogin().getModule(), getLogin().getCompanyNo(), pn100, getLogin().getUserName());
         System.out.println("---------------------NGAY-"+listHD.size());
        if (listHD.size() == 0) {
            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

            Date datecurent = new Date();
            nd353p = Util.toSQLDate(datecurent);

            String total = dateFormat.format(nd353p);
            System.out.println("---------------------NGAY--" + nd353p);
            String nv952 = total.substring(0, 4);
            String nv954 = total.substring(5, 7);
            String nv955 = total.substring(8, 10);

            System.out.println("---------------------NGAY--" + nv952 + "-" + nv954 + "-" + nv955);

            String sinhngay = "aaaa";//listHD.get(0).getNd118Str();// ngay sinh nhat
            String ngaycap = "aaaa";//listHD.get(0).getNd352Str();// ngay sinh nhat
            String noicap = "aaa";//listHD.get(0).getNv354();// noi cap
            String diachi ="aaa";// listHD.get(0).getNv112();// dia chi
            String cmnd = "aaa";//listHD.get(0).getNv351();// So CMND
            String quoctich = "aaa";//listHD.get(0).getQuoctich();// quoc tich
            String noisinh = "aaa";//listHD.get(0).getNoisinh();// quoc tich
            String nghenhiep = "aaa";//listHD.get(0).getNghenghiep();// quoc tich
            String hoten = "aaa";//listHD.get(0).getHoten();
            String hotenD ="aaa";// listHD.get(0).getHotenD();
            int pn100HD = 123;//listHD.get(0).getPn100();
            String dienthoai = "aaa";//listHD.get(0).getNv108();


            XWPFDocument document = new XWPFDocument();
            XWPFParagraph paragraph = document.createParagraph();
            XWPFRun run = paragraph.createRun();
            run.setText("Đơn vị : Công ty TNHH Du Hành Sài Gòn    CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM");
            // run.setTextPosition(-20);

            run.setFontSize(12);
            run.setFontFamily("VNI-Times");
            run.setSubscript(VerticalAlign.BASELINE);
            run.setBold(true);
            paragraph.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraphh1 = document.createParagraph();
            XWPFRun runn1 = paragraphh1.createRun();
            runn1.setText("Name of enterprise: Saigon Travel Co., Ltd.    SOCIALIST REPUBLIC OF VIET NAM");
            // run.setTextPosition(200);

            runn1.setFontSize(12);
            runn1.setFontFamily("VNI-Times");
            runn1.setSubscript(VerticalAlign.BASELINE);
            runn1.setBold(true);
            paragraphh1.setAlignment(ParagraphAlignment.LEFT);

            // right

            XWPFParagraph paragraphR = document.createParagraph();
            XWPFRun run2 = paragraphR.createRun();
            run2.setText("Số: 01-06/SGT-HĐLĐ                            Độc Lập - Tự Do - Hạnh Phúc");
            run2.setFontSize(12);
            run2.setFontFamily("VNI-Times");
            run2.setSubscript(VerticalAlign.BASELINE);
            run2.setBold(true);
            paragraphR.setAlignment(ParagraphAlignment.CENTER);

            XWPFParagraph paragraphR11 = document.createParagraph();
            XWPFRun run211 = paragraphR11.createRun();
            run211.setText("No: 01-06/SGT-HĐLĐ                            Independence-Freedom-Happiness");
            run211.setFontSize(12);
            run211.setFontFamily("VNI-Times");
            run211.setSubscript(VerticalAlign.BASELINE);
            run211.setBold(true);
            paragraphR11.setAlignment(ParagraphAlignment.CENTER);

            XWPFParagraph paragraphR1 = document.createParagraph();
            XWPFRun run3 = paragraphR1.createRun();
            run3.setText(" TP.HCM, ngày " + nv955 + " tháng " + nv954 + " năm " + nv952);
            run3.setFontSize(12);
            run3.setItalic(true);
            run3.setFontFamily("VNI-Times");
            run3.setSubscript(VerticalAlign.BASELINE);
            run3.setBold(false);
            paragraphR1.setAlignment(ParagraphAlignment.RIGHT);

            XWPFParagraph paragraphR111 = document.createParagraph();
            XWPFRun run311 = paragraphR111.createRun();
            run311.setText("HCM City, day " + nv955 + " month " + nv954 + " year " + nv952);
            run311.setFontSize(12);
            run311.setItalic(true);
            run311.setFontFamily("VNI-Times");
            run311.setSubscript(VerticalAlign.BASELINE);
            run311.setBold(false);
            paragraphR111.setAlignment(ParagraphAlignment.RIGHT);

            XWPFParagraph paragraphR2 = document.createParagraph();
            XWPFRun run4 = paragraphR2.createRun();
            run4.setText("HỢP ĐỒNG LAO ĐỘNG");
            run4.setFontSize(12);
            run4.setFontFamily("VNI-Times");
            run4.setSubscript(VerticalAlign.BASELINE);
            run4.setBold(true);
            paragraphR2.setAlignment(ParagraphAlignment.CENTER);
            XWPFParagraph paragraphR211 = document.createParagraph();
            XWPFRun run411 = paragraphR211.createRun();
            run411.setText("LABOUR CONTRACT");
            run411.setFontSize(12);
            run411.setFontFamily("VNI-Times");
            run411.setSubscript(VerticalAlign.BASELINE);
            run411.setBold(true);
            paragraphR211.setAlignment(ParagraphAlignment.CENTER);


            XWPFParagraph paragraphR3 = document.createParagraph();
            XWPFRun run5 = paragraphR3.createRun();
            run5.setText("(Ban theo Thông tư số 21/2003/TT-BLĐTBXH ngày 22/09/2003 Của Bộ Lao Động - Thương Binh - Xã Hội)");
            run5.setFontSize(12);
            run5.setFontFamily("VNI-Times");
            run5.setSubscript(VerticalAlign.BASELINE);
            run5.setBold(false);
            paragraphR3.setAlignment(ParagraphAlignment.CENTER);

            XWPFParagraph paragraphR311 = document.createParagraph();
            XWPFRun run511 = paragraphR311.createRun();
            run511.setText("(Issued under the Circular of the Ministry of Labour, Invalidsand Social Affairs No 21/2003/TT-BLÑTBXH on 22 September 2003)");
            run511.setFontSize(12);
            run511.setFontFamily("VNI-Times");
            run511.setSubscript(VerticalAlign.BASELINE);
            run511.setBold(false);
            paragraphR311.setAlignment(ParagraphAlignment.CENTER);


            XWPFParagraph paragraphR4 = document.createParagraph();
            XWPFRun run6 = paragraphR4.createRun();
            run6.setText("Chúng tôi, một bên là Ông: ");
            run6.setFontSize(12);
            run6.setFontFamily("VNI-Times");
            run6.setSubscript(VerticalAlign.BASELINE);
            run6.setBold(false);
            XWPFRun run7 = paragraphR4.createRun();
            run7.setText("NGUYỄN TRUNG KIÊN               ");
            run7.setFontSize(12);
            run7.setFontFamily("VNI-Times");
            run7.setSubscript(VerticalAlign.BASELINE);
            run7.setBold(true);

            XWPFParagraph paragraphR411 = document.createParagraph();
            XWPFRun run611 = paragraphR411.createRun();
            run611.setText("We are, from one side, Mr: ");
            run611.setFontSize(12);
            run611.setFontFamily("VNI-Times");
            run611.setSubscript(VerticalAlign.BASELINE);
            run611.setBold(false);
            XWPFRun run711 = paragraphR411.createRun();
            run711.setText("NGUYEN TRUNG KIEN               ");
            run711.setFontSize(12);
            run711.setFontFamily("VNI-Times");
            run711.setSubscript(VerticalAlign.BASELINE);
            run711.setBold(true);

            XWPFRun run8 = paragraphR4.createRun();
            run8.setText("Quốc tịch :");
            run8.setFontSize(12);
            run8.setFontFamily("VNI-Times");
            run8.setSubscript(VerticalAlign.BASELINE);
            //  run8.setBold(true);

            XWPFRun run9 = paragraphR4.createRun();
            run9.setText("Việt Nam");
            run9.setFontSize(12);
            run9.setFontFamily("VNI-Times");
            run9.setSubscript(VerticalAlign.BASELINE);
            run9.setBold(true);

            XWPFRun run811 = paragraphR411.createRun();
            run811.setText("Nationality :");
            run811.setFontSize(12);
            run811.setFontFamily("VNI-Times");
            run811.setSubscript(VerticalAlign.BASELINE);
            //  run8.setBold(true);

            XWPFRun run911 = paragraphR411.createRun();
            run911.setText("Vietnam");
            run911.setFontSize(12);
            run911.setFontFamily("VNI-Times");
            run911.setSubscript(VerticalAlign.BASELINE);
            run911.setBold(true);

            paragraphR411.setAlignment(ParagraphAlignment.LEFT);

            // chuc vụ

            XWPFParagraph paragraph5 = document.createParagraph();
            XWPFRun run10 = paragraph5.createRun();
            run10.setText("Chức vụ : Giám đốc điều hành");
            run10.setFontSize(12);
            run10.setFontFamily("VNI-Times");
            run10.setSubscript(VerticalAlign.BASELINE);
            paragraph5.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph511 = document.createParagraph();
            XWPFRun run1011 = paragraph511.createRun();
            run1011.setText("Posision: Managing director");
            run1011.setFontSize(12);
            run1011.setFontFamily("VNI-Times");
            run1011.setSubscript(VerticalAlign.BASELINE);
            paragraph511.setAlignment(ParagraphAlignment.LEFT);
            //
//Đại diện cho: CÔNG TY TNHH DU HÀNH SÀI GÒN
//Điện thoại: +84 3925-6868
            XWPFParagraph paragraph6 = document.createParagraph();
            XWPFRun run11 = paragraph6.createRun();
            run11.setText("Đại diện cho: CÔNG TY TNHH DU HÀNH SÀI GÒN               Điện thoại: +84 3925-6868");
            run11.setFontSize(12);
            run11.setFontFamily("VNI-Times");
            run11.setSubscript(VerticalAlign.BASELINE);
            paragraph6.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph611 = document.createParagraph();
            XWPFRun run111 = paragraph611.createRun();
            run111.setText("On behalf of: Saigon Travel Co., Ltd.               Telephone: +84 3925-6868");
            run111.setFontSize(12);
            run111.setFontFamily("VNI-Times");
            run111.setSubscript(VerticalAlign.BASELINE);
            paragraph611.setAlignment(ParagraphAlignment.LEFT);

            //Địa chỉ: Lầu 10, Tòa nhà Nam Á, 201-203 Cách mạng tháng 8, P.4, Q.3, TP.Hồ Chí Minh

            XWPFParagraph paragraph7 = document.createParagraph();
            XWPFRun run12 = paragraph7.createRun();
            run12.setText("Địa chỉ: Lầu 10, Tòa nhà Nam Á, 201-203 Cách mạng tháng 8, P.4, Q.3, TP.Hồ Chí Minh");
            run12.setFontSize(12);
            run12.setFontFamily("VNI-Times");
            run12.setSubscript(VerticalAlign.BASELINE);
            paragraph7.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph71 = document.createParagraph();
            XWPFRun run121 = paragraph71.createRun();
            run121.setText("Address: 10th Floor, Nam A Building, 201- 203 Cach Mang Thang 8 Street, Ward 4, Dist. 4, HCM City");
            run121.setFontSize(12);
            run121.setFontFamily("VNI-Times");
            run121.setSubscript(VerticalAlign.BASELINE);
            paragraph71.setAlignment(ParagraphAlignment.LEFT);

            // 1 bên

            XWPFParagraph paragraph8 = document.createParagraph();
            XWPFRun run13 = paragraph8.createRun();
            run13.setText("Chúng tôi, một bên là: ");
            run13.setFontSize(12);
            run13.setFontFamily("VNI-Times");
            run13.setSubscript(VerticalAlign.BASELINE);
            run13.setBold(false);



            XWPFRun run14 = paragraph8.createRun();
            run14.setText(hoten + "                      ");
            run14.setFontSize(12);
            run14.setFontFamily("VNI-Times");
            run14.setSubscript(VerticalAlign.BASELINE);
            run14.setBold(true);




            XWPFRun run15 = paragraph8.createRun();
            run15.setText("Quốc tịch :");
            run15.setFontSize(12);
            run15.setFontFamily("VNI-Times");
            run15.setSubscript(VerticalAlign.BASELINE);
            //  run8.setBold(true);





            XWPFRun run16 = paragraph8.createRun();
            run16.setText(quoctich);
            run16.setFontSize(12);
            run16.setFontFamily("VNI-Times");
            run16.setSubscript(VerticalAlign.BASELINE);
            run16.setBold(true);

            paragraph8.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph81 = document.createParagraph();
            XWPFRun run131 = paragraph81.createRun();
            run131.setText("And from other side: ");
            run131.setFontSize(12);
            run131.setFontFamily("VNI-Times");
            run131.setSubscript(VerticalAlign.BASELINE);
            run131.setBold(false);


            XWPFRun run141 = paragraph81.createRun();
            run141.setText(hoten + "                      ");
            run141.setFontSize(12);
            run141.setFontFamily("VNI-Times");
            run141.setSubscript(VerticalAlign.BASELINE);
            run141.setBold(true);


            XWPFRun run151 = paragraph81.createRun();
            run151.setText("Nationality :");
            run151.setFontSize(12);
            run151.setFontFamily("VNI-Times");
            run151.setSubscript(VerticalAlign.BASELINE);

            XWPFRun run161 = paragraph81.createRun();
            run161.setText(quoctich);
            run161.setFontSize(12);
            run161.setFontFamily("VNI-Times");
            run161.setSubscript(VerticalAlign.BASELINE);
            run161.setBold(true);
            paragraph81.setAlignment(ParagraphAlignment.LEFT);

            //






            //  run8.setBold(true);





            // chuc vụ

            XWPFParagraph paragraph9 = document.createParagraph();
            XWPFRun run17 = paragraph9.createRun();
            run17.setText("Sinh ngày " + sinhngay + "tại " + noisinh);
            run17.setFontSize(12);
            run17.setFontFamily("VNI-Times");
            run17.setSubscript(VerticalAlign.BASELINE);
            paragraph9.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph91 = document.createParagraph();
            XWPFRun run171 = paragraph91.createRun();
            run171.setText("Date of birth  " + sinhngay + "at " + noisinh);
            run171.setFontSize(12);
            run171.setFontFamily("VNI-Times");
            run171.setSubscript(VerticalAlign.BASELINE);
            paragraph91.setAlignment(ParagraphAlignment.LEFT);

            //
//Đại diện cho: CÔNG TY TNHH DU HÀNH SÀI GÒN
//Điện thoại: +84 3925-6868
            XWPFParagraph paragraph10 = document.createParagraph();
            XWPFRun run18 = paragraph10.createRun();
            run18.setText("Nghề nghiệp: " + nghenhiep + "                                      Điện thoại: " + dienthoai);
            run18.setFontSize(12);
            run18.setFontFamily("VNI-Times");
            run18.setSubscript(VerticalAlign.BASELINE);
            paragraph10.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph101 = document.createParagraph();
            XWPFRun run181 = paragraph101.createRun();
            run181.setText("Occupation: " + nghenhiep + "                                      Telephone: " + dienthoai);
            run181.setFontSize(12);
            run181.setFontFamily("VNI-Times");
            run181.setSubscript(VerticalAlign.BASELINE);
            paragraph101.setAlignment(ParagraphAlignment.LEFT);

            //Địa chỉ: Lầu 10, Tòa nhà Nam Á, 201-203 Cách mạng tháng 8, P.4, Q.3, TP.Hồ Chí Minh

            XWPFParagraph paragraph11 = document.createParagraph();
            XWPFRun run19 = paragraph11.createRun();
            run19.setText("Địa chỉ: " + diachi);
            run19.setFontSize(12);
            run19.setFontFamily("VNI-Times");
            run19.setSubscript(VerticalAlign.BASELINE);
            paragraph11.setAlignment(ParagraphAlignment.LEFT);
            //Số CMND : 22342355Ngày cấp: 12/12/2003Công An Đông Nai
            XWPFParagraph paragraph12 = document.createParagraph();
            XWPFRun run20 = paragraph12.createRun();
            run20.setText("Số CMND : " + cmnd + "                    Ngày cấp: " + ngaycap + "               " + noicap);
            run20.setFontSize(12);
            run20.setFontFamily("VNI-Times");
            run20.setSubscript(VerticalAlign.BASELINE);
            paragraph12.setAlignment(ParagraphAlignment.LEFT);



            XWPFParagraph paragraph111 = document.createParagraph();
            XWPFRun run191 = paragraph111.createRun();
            run191.setText("Permanent Address: " + diachi);
            run191.setFontSize(12);
            run191.setFontFamily("VNI-Times");
            run191.setSubscript(VerticalAlign.BASELINE);
            paragraph111.setAlignment(ParagraphAlignment.LEFT);
            //Số CMND : 22342355Ngày cấp: 12/12/2003Công An Đông Nai
            XWPFParagraph paragraph121 = document.createParagraph();
            XWPFRun run201 = paragraph121.createRun();
            run201.setText("ID card No : " + cmnd + "                    issued on: " + ngaycap + "             at " + noicap);
            run201.setFontSize(12);
            run201.setFontFamily("VNI-Times");
            run201.setSubscript(VerticalAlign.BASELINE);
            paragraph121.setAlignment(ParagraphAlignment.LEFT);

            // Thỏa thuận ký kết hợp đồng và làm đúng cam kết những điều khoản sau đây:

            XWPFParagraph paragraph13 = document.createParagraph();
            XWPFRun run21 = paragraph13.createRun();
            run21.setText("Thỏa thuận ký kết hợp đồng và làm đúng cam kết những điều khoản sau đây:");
            run21.setFontSize(12);
            run21.setFontFamily("VNI-Times");
            run21.setSubscript(VerticalAlign.BASELINE);
            paragraph13.setAlignment(ParagraphAlignment.LEFT);



            XWPFParagraph paragraph131 = document.createParagraph();
            XWPFRun run2111 = paragraph131.createRun();
            run2111.setText("Agree to sign this labour contract and commit to implement the following provisions:");
            run2111.setFontSize(12);
            run2111.setFontFamily("VNI-Times");
            run2111.setSubscript(VerticalAlign.BASELINE);
            paragraph131.setAlignment(ParagraphAlignment.LEFT);

            //Điều 1: Thời hạn và công việc hợp đồng

            XWPFParagraph paragraph14 = document.createParagraph();
            XWPFRun run22 = paragraph14.createRun();
            run22.setText("Điều 1: Thời hạn và công việc hợp đồng");
            run22.setFontSize(12);
            run22.setFontFamily("VNI-Times");
            run22.setBold(true);
            run22.setSubscript(VerticalAlign.BASELINE);
            paragraph14.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph141 = document.createParagraph();
            XWPFRun run221 = paragraph141.createRun();
            run221.setText("Article 1: Term and work contract");
            run221.setFontSize(12);
            run221.setFontFamily("VNI-Times");
            run221.setBold(true);
            run221.setSubscript(VerticalAlign.BASELINE);
            paragraph141.setAlignment(ParagraphAlignment.LEFT);
            //- Loại hợp đồng lao động : Xác định có thời hạn
//- Từ ngày 10 tháng 6 năm 2011 đến ngày 9 tháng 6 năm 2012
//- Nơi làm việc: Công ty TNHH Du Hành Sài Gòn, Lầu 10, Tòa nhà Nam Á, 201-203 Cách mạng tháng 8, P.4, Q.3, TP.Hồ Chí Minh
//- Chứa danh chuyên môn : Nhân viên kinh doanh

            XWPFParagraph paragraph15 = document.createParagraph();
            XWPFRun run23 = paragraph15.createRun();
            run23.setText("- Loại hợp đồng lao động : Xác định có thời hạn");
            run23.setFontSize(12);
            run23.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run23.setSubscript(VerticalAlign.BASELINE);
            paragraph14.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph151 = document.createParagraph();
            XWPFRun run231 = paragraph151.createRun();
            run231.setText("- Type of labour contract: Definite contract");
            run231.setFontSize(12);
            run231.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run231.setSubscript(VerticalAlign.BASELINE);
            paragraph151.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph16 = document.createParagraph();
            XWPFRun run24 = paragraph16.createRun();
            run24.setText("- Từ ngày 10 tháng 6 năm 2011 đến ngày 9 tháng 6 năm 2012");
            run24.setFontSize(12);
            run24.setFontFamily("VNI-Times");
            // run22.setBold(true);
            run24.setSubscript(VerticalAlign.BASELINE);
            paragraph16.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph161 = document.createParagraph();
            XWPFRun run241 = paragraph161.createRun();
            run241.setText("- From date 10 month 6 year 6 to date 9 month 6 year 2012");
            run241.setFontSize(12);
            run241.setFontFamily("VNI-Times");
            // run22.setBold(true);
            run241.setSubscript(VerticalAlign.BASELINE);
            paragraph161.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph17 = document.createParagraph();
            XWPFRun run25 = paragraph17.createRun();
            run25.setText("- Nơi làm việc: Công ty TNHH Du Hành Sài Gòn, Lầu 10, Tòa nhà Nam Á, 201-203 Cách mạng tháng 8, P.4, Q.3, TP.Hồ Chí Minh");
            run25.setFontSize(12);
            run25.setFontFamily("VNI-Times");
            // run25.setBold(true);
            run25.setSubscript(VerticalAlign.BASELINE);
            paragraph17.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph171 = document.createParagraph();
            XWPFRun run251 = paragraph171.createRun();
            run251.setText("- Place of work: Saigon Travel Co., Ltd, 10th floor, Nam A Building, 201- 203 Cach Mang Thang 8 Street, Ward 4, Dist. 3, HCM City");
            run251.setFontSize(12);
            run251.setFontFamily("VNI-Times");
            // run25.setBold(true);
            run251.setSubscript(VerticalAlign.BASELINE);
            paragraph171.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph18 = document.createParagraph();
            XWPFRun run26 = paragraph18.createRun();
            run26.setText("- Chứa danh chuyên môn : Nhân viên kinh doanh");
            run26.setFontSize(12);
            run26.setFontFamily("VNI-Times");
            // run25.setBold(true);
            run26.setSubscript(VerticalAlign.BASELINE);
            paragraph18.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph181 = document.createParagraph();
            XWPFRun run261 = paragraph181.createRun();
            run261.setText("- Qualification: Sales Executive");
            run261.setFontSize(12);
            run261.setFontFamily("VNI-Times");
            // run25.setBold(true);
            run261.setSubscript(VerticalAlign.BASELINE);
            paragraph181.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph19 = document.createParagraph();
            XWPFRun run27 = paragraph19.createRun();
            run27.setText("Điều 2: Chế độ làm việc");
            run27.setFontSize(12);
            run27.setFontFamily("VNI-Times");
            run27.setBold(true);
            run27.setSubscript(VerticalAlign.BASELINE);
            paragraph19.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph191 = document.createParagraph();
            XWPFRun run271 = paragraph191.createRun();
            run271.setText("Article 2: Work regime");
            run271.setFontSize(12);
            run271.setFontFamily("VNI-Times");
            run271.setBold(true);
            run271.setSubscript(VerticalAlign.BASELINE);
            paragraph191.setAlignment(ParagraphAlignment.LEFT);
            //- Loại hợp đồng lao động : Xác định có thời hạn
//- Từ ngày 10 tháng 6 năm 2011 đến ngày 9 tháng 6 năm 2012
//- Nơi làm việc: Công ty TNHH Du Hành Sài Gòn, Lầu 10, Tòa nhà Nam Á, 201-203 Cách mạng tháng 8, P.4, Q.3, TP.Hồ Chí Minh
//- Chứa danh chuyên môn : Nhân viên kinh doanh

            XWPFParagraph paragraph20 = document.createParagraph();
            XWPFRun run28 = paragraph20.createRun();
            run28.setText("- Thời gian làm việc: 44 giờ/ Tuần từ thứ 2 đến thứ 7");
            run28.setFontSize(12);
            run28.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run28.setSubscript(VerticalAlign.BASELINE);
            paragraph20.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph201 = document.createParagraph();
            XWPFRun run281 = paragraph201.createRun();
            run281.setText("- Time of work: 44 hours/week from Monday to Saturday");
            run281.setFontSize(12);
            run281.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run281.setSubscript(VerticalAlign.BASELINE);
            paragraph201.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph21 = document.createParagraph();
            XWPFRun run29 = paragraph21.createRun();
            run29.setText("Điều 3: Nghĩa vụ và quyền lợi người lao động");
            run29.setFontSize(12);
            run29.setFontFamily("VNI-Times");
            run29.setBold(true);
            run29.setSubscript(VerticalAlign.BASELINE);
            paragraph21.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph211 = document.createParagraph();
            XWPFRun run291 = paragraph211.createRun();
            run291.setText("Article 3: Obligations, rights and benefits of the employee");
            run291.setFontSize(12);
            run291.setFontFamily("VNI-Times");
            run291.setBold(true);
            run291.setSubscript(VerticalAlign.BASELINE);
            paragraph211.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph22 = document.createParagraph();
            XWPFRun run30 = paragraph22.createRun();
            run30.setText("1.Quyền lợi");
            run30.setFontSize(12);
            run30.setFontFamily("VNI-Times");
            run30.setBold(true);
            run30.setSubscript(VerticalAlign.BASELINE);
            paragraph22.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph221 = document.createParagraph();
            XWPFRun run301 = paragraph221.createRun();
            run301.setText("1.Rights and benefits");
            run301.setFontSize(12);
            run301.setFontFamily("VNI-Times");
            run301.setBold(true);
            run301.setSubscript(VerticalAlign.BASELINE);
            paragraph221.setAlignment(ParagraphAlignment.LEFT);










            XWPFParagraph paragraph23 = document.createParagraph();
            XWPFRun run31 = paragraph23.createRun();
            run31.setText("-  Phương tiện đi lại làm việc tự túc");
            run31.setFontSize(12);
            run31.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run31.setSubscript(VerticalAlign.BASELINE);
            paragraph23.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph231 = document.createParagraph();
            XWPFRun run3111 = paragraph231.createRun();
            run3111.setText("- Means of transport for working: at own expense");
            run3111.setFontSize(12);
            run3111.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run3111.setSubscript(VerticalAlign.BASELINE);
            paragraph231.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph24 = document.createParagraph();
            XWPFRun run32 = paragraph24.createRun();
            run32.setText("- Mức lương chính hoặc tiền công: 10,000,000 VND");
            run32.setFontSize(12);
            run32.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run32.setSubscript(VerticalAlign.BASELINE);
            paragraph24.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph241 = document.createParagraph();
            XWPFRun run321 = paragraph241.createRun();
            run321.setText("- Basic salary or wages: 10.000.000 VND");
            run321.setFontSize(12);
            run321.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run321.setSubscript(VerticalAlign.BASELINE);
            paragraph241.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph25 = document.createParagraph();
            XWPFRun run33 = paragraph25.createRun();
            run33.setText("- Hình thức trả lương: Lương theo thời gian");
            run33.setFontSize(12);
            run33.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run33.setSubscript(VerticalAlign.BASELINE);
            paragraph25.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph251 = document.createParagraph();
            XWPFRun run331 = paragraph251.createRun();
            run331.setText("- Form of paying wage: Pay according to attendance timesheet");
            run331.setFontSize(12);
            run331.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run33.setSubscript(VerticalAlign.BASELINE);
            paragraph25.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph26 = document.createParagraph();
            XWPFRun run34 = paragraph26.createRun();
            run34.setText("- Được trả lương vào ngày 5 hàng tháng");
            run34.setFontSize(12);
            run34.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run34.setSubscript(VerticalAlign.BASELINE);
            paragraph26.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph261 = document.createParagraph();
            XWPFRun run341 = paragraph261.createRun();
            run341.setText("- To be paid monthly on the 5th ");
            run341.setFontSize(12);
            run341.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run341.setSubscript(VerticalAlign.BASELINE);
            paragraph261.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph27 = document.createParagraph();
            XWPFRun run35 = paragraph27.createRun();
            run35.setText("- Chế độ tăng lương: Dựa vào đánh giá KPI");
            run35.setFontSize(12);
            run35.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run35.setSubscript(VerticalAlign.BASELINE);
            paragraph27.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph271 = document.createParagraph();
            XWPFRun run351 = paragraph271.createRun();
            run351.setText("- Regime of advancement in wage grades: based on KPI assessment form");
            run351.setFontSize(12);
            run351.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run351.setSubscript(VerticalAlign.BASELINE);
            paragraph271.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph28 = document.createParagraph();
            XWPFRun run36 = paragraph28.createRun();
            run36.setText("- Chế độ nghỉ ngơi (nghỉ hàng tuần, phép năm. lễ tết…): 12 ngày/phép và 3 năm sau được tăng thêm 1 ngày phép,và 9 ngày lễ theo quy định của nhà nước");
            run36.setFontSize(12);
            run36.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run36.setSubscript(VerticalAlign.BASELINE);
            paragraph28.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph281 = document.createParagraph();
            XWPFRun run361 = paragraph281.createRun();
            run361.setText("- Time of rest (weekly leave, annual leave, and public holiday…): 12 annual days for 1st year and after 3 working years, plus 1 annual day ");
            run361.setFontSize(12);
            run361.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run361.setSubscript(VerticalAlign.BASELINE);
            paragraph281.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph29 = document.createParagraph();
            XWPFRun run37 = paragraph29.createRun();
            run37.setText("- Bảo hiểm xã hội và y tế: Được trích nộp 28.5 % theo Luật lao động hiện hành (Trong đó người lao động 6% BHXH và 1.5% BHYT,1% BHTN, Công ty đóng 16% BHXH, 3% BHYT, 1% BHTN)");
            run37.setFontSize(12);
            run37.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run37.setSubscript(VerticalAlign.BASELINE);
            paragraph29.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph291 = document.createParagraph();
            XWPFRun run371 = paragraph291.createRun();
            run371.setText("- Social insurance and health insurance: 28.5% as per Labour law (in which the employee pays 6% for social insurance and 1.5% for health insurance, 1% unemployment insurance, employer contributes 16% for social insurance and 3% for health insurance, 1% unemployment insurance)");
            run371.setFontSize(12);
            run371.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run371.setSubscript(VerticalAlign.BASELINE);
            paragraph291.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph30 = document.createParagraph();
            XWPFRun run38 = paragraph30.createRun();
            run38.setText("- Chế độ đào tạo : Không");
            run38.setFontSize(12);
            run38.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run38.setSubscript(VerticalAlign.BASELINE);
            paragraph30.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph301 = document.createParagraph();
            XWPFRun run381 = paragraph301.createRun();
            run381.setText("- Regime for vocational training: No");
            run381.setFontSize(12);
            run381.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run381.setSubscript(VerticalAlign.BASELINE);
            paragraph301.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph31 = document.createParagraph();
            XWPFRun run39 = paragraph31.createRun();
            run39.setText("- Những thỏa thuận khác : Không");
            run39.setFontSize(12);
            run39.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run39.setSubscript(VerticalAlign.BASELINE);
            paragraph31.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph311 = document.createParagraph();
            XWPFRun run391 = paragraph311.createRun();
            run391.setText("- Other agreements: No");
            run391.setFontSize(12);
            run391.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run391.setSubscript(VerticalAlign.BASELINE);
            paragraph311.setAlignment(ParagraphAlignment.LEFT);






            XWPFParagraph paragraph32 = document.createParagraph();
            XWPFRun run40 = paragraph32.createRun();
            run40.setText("2.Nghĩa vụ");
            run40.setFontSize(12);
            run40.setFontFamily("VNI-Times");
            run40.setBold(true);
            run40.setSubscript(VerticalAlign.BASELINE);
            paragraph32.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph321 = document.createParagraph();
            XWPFRun run401 = paragraph32.createRun();
            run401.setText("2.Obligations");
            run401.setFontSize(12);
            run401.setFontFamily("VNI-Times");
            run401.setBold(true);
            run401.setSubscript(VerticalAlign.BASELINE);
            paragraph321.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph33 = document.createParagraph();
            XWPFRun run41 = paragraph33.createRun();
            run41.setText("- Chịu trách nhiệm và thực hiện công việc theo sử điều hành của ban giám đốc");
            run41.setFontSize(12);
            run41.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run41.setSubscript(VerticalAlign.BASELINE);
            paragraph33.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph331 = document.createParagraph();
            XWPFRun run4111 = paragraph331.createRun();
            run4111.setText("- To be responsible and fulfill the jobs directly from Board of Director");
            run4111.setFontSize(12);
            run4111.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run4111.setSubscript(VerticalAlign.BASELINE);
            paragraph331.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph34 = document.createParagraph();
            XWPFRun run42 = paragraph34.createRun();
            run42.setText("- Nghiêm chỉnh chấp hành nội quy của công ty ");
            run42.setFontSize(12);
            run42.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run42.setSubscript(VerticalAlign.BASELINE);
            paragraph34.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph341 = document.createParagraph();
            XWPFRun run421 = paragraph341.createRun();
            run421.setText("- To observe strictly regulations and rules of company ");
            run421.setFontSize(12);
            run421.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run421.setSubscript(VerticalAlign.BASELINE);
            paragraph341.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph35 = document.createParagraph();
            XWPFRun run43 = paragraph35.createRun();
            run43.setText("- Nếu người lao động vi phạm thì sẽ bị kỷ luật và bồi thường cho công ty");
            run43.setFontSize(12);
            run43.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run43.setSubscript(VerticalAlign.BASELINE);
            paragraph35.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph351 = document.createParagraph();
            XWPFRun run431 = paragraph351.createRun();
            run431.setText("- Employee will be subject to discipline and compensation in accordance with company’s regulations if violating");
            run431.setFontSize(12);
            run431.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run431.setSubscript(VerticalAlign.BASELINE);
            paragraph351.setAlignment(ParagraphAlignment.LEFT);




            XWPFParagraph paragraph36 = document.createParagraph();
            XWPFRun run44 = paragraph36.createRun();
            run44.setText("Điều 4: Nghĩa vụ và quyền hạn của người lao động");
            run44.setFontSize(12);
            run44.setFontFamily("VNI-Times");
            run44.setBold(true);
            run44.setSubscript(VerticalAlign.BASELINE);
            paragraph36.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph361 = document.createParagraph();
            XWPFRun run441 = paragraph361.createRun();
            run441.setText("Article 4: Obligations and rights of employer");
            run441.setFontSize(12);
            run441.setFontFamily("VNI-Times");
            run441.setBold(true);
            run441.setSubscript(VerticalAlign.BASELINE);
            paragraph36.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph37 = document.createParagraph();
            XWPFRun run45 = paragraph37.createRun();
            run45.setText("1.Nghĩa vụ");
            run45.setFontSize(12);
            run45.setFontFamily("VNI-Times");
            run45.setBold(true);
            run45.setSubscript(VerticalAlign.BASELINE);
            paragraph37.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph371 = document.createParagraph();
            XWPFRun run451 = paragraph371.createRun();
            run451.setText("1.Obiligations");
            run451.setFontSize(12);
            run451.setFontFamily("VNI-Times");
            run451.setBold(true);
            run451.setSubscript(VerticalAlign.BASELINE);
            paragraph371.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph38 = document.createParagraph();
            XWPFRun run46 = paragraph38.createRun();
            run46.setText("- Bảo đảm việc làm và thực hiện những điểu khoản đã ghi trong cam kết hợp đồng lao động");
            run46.setFontSize(12);
            run46.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run46.setSubscript(VerticalAlign.BASELINE);
            paragraph38.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph381 = document.createParagraph();
            XWPFRun run461 = paragraph381.createRun();
            run461.setText("- To ensure the employment and fully implement committed regulations in labour contract");
            run461.setFontSize(12);
            run461.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run461.setSubscript(VerticalAlign.BASELINE);
            paragraph381.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph39 = document.createParagraph();
            XWPFRun run47 = paragraph39.createRun();
            run47.setText("- Thanh toán đầy đủ, đúng thời hạn các chế độ và quyền lợi cho người lao đọngp theo hợp đồng lao động, thỏa ước lao động tập thể nếu có");
            run47.setFontSize(12);
            run47.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run47.setSubscript(VerticalAlign.BASELINE);
            paragraph39.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph391 = document.createParagraph();
            XWPFRun run471 = paragraph391.createRun();
            run471.setText("- To pay fully on time all remuneration and other fringe benefits of employee in accordance with labour contract, collective labour agreements, if any");
            run471.setFontSize(12);
            run471.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run471.setSubscript(VerticalAlign.BASELINE);
            paragraph391.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph40 = document.createParagraph();
            XWPFRun run48 = paragraph40.createRun();
            run48.setText("2.Quyền hạn");
            run48.setFontSize(12);
            run48.setFontFamily("VNI-Times");
            run48.setBold(true);
            run48.setSubscript(VerticalAlign.BASELINE);
            paragraph40.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph401 = document.createParagraph();
            XWPFRun run481 = paragraph401.createRun();
            run481.setText("2.Rights");
            run481.setFontSize(12);
            run481.setFontFamily("VNI-Times");
            run481.setBold(true);
            run481.setSubscript(VerticalAlign.BASELINE);
            paragraph401.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph41 = document.createParagraph();
            XWPFRun run49 = paragraph41.createRun();
            run49.setText("- Điều hành người lao động hoàn thành theo hợp đồng(bố trí, tạm chuyển, ngừng làm việc)");
            run49.setFontSize(12);
            run49.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run49.setSubscript(VerticalAlign.BASELINE);
            paragraph41.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph4122 = document.createParagraph();
            XWPFRun run491 = paragraph4122.createRun();
            run491.setText("- To manage the employee to fullfill the works in accordance with labour contract (assign, appoint, postpone…)");
            run491.setFontSize(12);
            run491.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run491.setSubscript(VerticalAlign.BASELINE);
            paragraph4122.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph42 = document.createParagraph();
            XWPFRun run50 = paragraph42.createRun();
            run50.setText("- Tạm hoãn, bố trí, chấm dứ hợp đồng lao động, kỷ luật người theo quy định của pháp luật. ");
            run50.setFontSize(12);
            run50.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run50.setSubscript(VerticalAlign.BASELINE);
            paragraph42.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph421 = document.createParagraph();
            XWPFRun run501 = paragraph421.createRun();
            run501.setText("- To postpone, terminate the labour contract, penalty the employee in accordance with the law, collectiove labour agreement (if any) and internal labour regulations of enterprises");
            run501.setFontSize(12);
            run501.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run501.setSubscript(VerticalAlign.BASELINE);
            paragraph421.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph43 = document.createParagraph();
            XWPFRun run51 = paragraph43.createRun();
            run51.setText("- Nếu người lao động vi phạm thì sẽ bị kỷ luật và bồi thường cho công ty");
            run51.setFontSize(12);
            run51.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run51.setSubscript(VerticalAlign.BASELINE);
            paragraph43.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph44 = document.createParagraph();
            XWPFRun run52 = paragraph44.createRun();
            run52.setText("Điều 5: Điều khoản thi hành");
            run52.setFontSize(12);
            run52.setFontFamily("VNI-Times");
            run52.setBold(true);
            run52.setSubscript(VerticalAlign.BASELINE);
            paragraph44.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph441 = document.createParagraph();
            XWPFRun run521 = paragraph441.createRun();
            run521.setText("Article 5: Implementation provisions");
            run521.setFontSize(12);
            run521.setFontFamily("VNI-Times");
            run521.setBold(true);
            run521.setSubscript(VerticalAlign.BASELINE);
            paragraph441.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph45 = document.createParagraph();
            XWPFRun run53 = paragraph45.createRun();
            run53.setText("- Những vấn để lao động không ghi trong hợp đồng lao động này thì áp dụng quy định của thảo ước tập thể, trường hợp không có thỏa ước tập thể thì áp dụng theo quy định pháp luật");
            run53.setFontSize(12);
            run53.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run53.setSubscript(VerticalAlign.BASELINE);
            paragraph45.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph451 = document.createParagraph();
            XWPFRun run531 = paragraph451.createRun();
            run531.setText("- The problems concerning with labour is not defined in labour contract shall be applied with provisions of collective labour agreement. In case of not having collective labour agreement shall be applied regulations of labour legislation.");
            run531.setFontSize(12);
            run531.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run531.setSubscript(VerticalAlign.BASELINE);
            paragraph451.setAlignment(ParagraphAlignment.LEFT);



            XWPFParagraph paragraph46 = document.createParagraph();
            XWPFRun run54 = paragraph46.createRun();
            run54.setText("- Hợp đồng lao động được tạo thành hai bản có giá trị ngang nhau, mỗi bên giữ một bản và có hiệu lực từ ngày 01 tháng 01 năm 2010. Khi 2 bên ký phụ lục hợp đồng lao động thì nội dung của phụ lục hợp đồng cũng có giá trị như các nội dung của bản hợp đồng lao động này.");
            run54.setFontSize(12);
            run54.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run54.setSubscript(VerticalAlign.BASELINE);
            paragraph35.setAlignment(ParagraphAlignment.LEFT);


            XWPFParagraph paragraph461 = document.createParagraph();
            XWPFRun run541 = paragraph461.createRun();
            run541.setText("- Labour contract is made in 02 copies of equal validity, each party keeps one copy and comes into force on date 10 month 6 year 2011. When both parties sign appendix of labour contract, the content of appendix shall be valued as the contents of this labour contract.");
            run541.setFontSize(12);
            run541.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run541.setSubscript(VerticalAlign.BASELINE);
            paragraph351.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph47 = document.createParagraph();
            XWPFRun run55 = paragraph47.createRun();
            run55.setText("- Hợp đồng lao động này làm tại Công ty TNHH Du Hành Sài Gòn ngày 01 tháng 02 năm 0303");
            run55.setFontSize(12);
            run55.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run55.setSubscript(VerticalAlign.BASELINE);
            paragraph47.setAlignment(ParagraphAlignment.LEFT);

            XWPFParagraph paragraph471 = document.createParagraph();
            XWPFRun run551 = paragraph471.createRun();
            run551.setText("- This labour contract is made at Saigon Travel Co., Ltd on date 10 month 6 year 2011.");
            run551.setFontSize(12);
            run551.setFontFamily("VNI-Times");
            // run23.setBold(true);
            run551.setSubscript(VerticalAlign.BASELINE);
            paragraph471.setAlignment(ParagraphAlignment.LEFT);



            XWPFParagraph paragraph48 = document.createParagraph();
            XWPFRun run56 = paragraph48.createRun();
            run56.setText("NGƯỜI LAO ĐỘNG                                      NGƯỜI SỬ DỤNG LAO ĐỘNG");
            run56.setFontSize(12);
            run56.setFontFamily("VNI-Times");
            run56.setBold(true);
            run56.setSubscript(VerticalAlign.BASELINE);
            paragraph48.setAlignment(ParagraphAlignment.CENTER);

            XWPFParagraph paragraph481 = document.createParagraph();
            XWPFRun run561 = paragraph481.createRun();
            run561.setText("EMPOYEE                                      EMPLOYER");
            run561.setFontSize(12);
            run561.setFontFamily("VNI-Times");
            run561.setBold(true);
            run561.setSubscript(VerticalAlign.BASELINE);
            paragraph481.setAlignment(ParagraphAlignment.CENTER);


//              File fileout = new File(ResourcesProvider.getReportExcel() + "report.xls");
//            FileOutputStream fileOut = new FileOutputStream(fileout);
//            wb.write(fileOut);
//            fileOut.close();
//
//            sendRedirect(url + "resources/excel/report.xls");
//
//            System.out.println("sendRedirect----:" + ResourcesProvider.getReportExcel() + "report.xls");
            try {
                File fileout = new File(ResourcesProvider.getReportExcel() + hotenD + ".docx");
                // File fileout = new File("D:\\" + hotenD + ".docx");
                FileOutputStream out = new FileOutputStream(fileout);


                document.write(out);
                out.close();
                // sendRedirect(url + "resources/excel/"+hotenD+".docx");
                System.out.println("sendRedirect----:" + url + "resources/excel/" + hotenD + ".docx");
                SessionProvider.setSessionMapValue("LINKSAVE", url + "resources/excel/" + hotenD + ".docx");
                sendRedirect("viewdocument.jsp");
            } catch (Exception e) {
            }
        }

    }

    // doc file new
    public void redfileWord1() {
        try {
            File file = null;
            WordExtractor extractor = null;


            file = new File("D:\\laodong.doc");
            FileInputStream fis = new FileInputStream(file.getAbsolutePath());
            HWPFDocument document = new HWPFDocument(fis);
            extractor = new WordExtractor(document);
            String[] fileData = extractor.getParagraphText();
            for (int i = 0; i < fileData.length; i++) {
                if (fileData[i] != null) {
                    System.out.println(fileData[i]);
                }
            }

        } catch (Exception e) {
        }
    }

    // doc File
    public void redfileWord() {
        try {

            /**
             * This is the document that you want to read using Java.*
             */
            String fileName = "D:\\laodong.doc";

            /**
             * Method call to read the document (demonstrate some useage of
             * POI)*
             */
            readMyDocument(fileName);

            sendRedirect("contractRead.jsp");

        } catch (Exception e) {
        }
    }

    public static void readMyDocument(String fileName) {
        POIFSFileSystem fs = null;
        try {
            fs = new POIFSFileSystem(new FileInputStream(fileName));
            HWPFDocument doc = new HWPFDocument(fs);

            /**
             * Read the content *
             */
            readParagraphs(doc);

            int pageNumber = 3;

            /**
             * We will try reading the header for page 1*
             */
            readHeader(doc, pageNumber);

            /**
             * Let's try reading the footer for page 1*
             */
            readFooter(doc, pageNumber);

            /**
             * Read the document summary*
             */
            readDocumentSummary(doc);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void readParagraphs(HWPFDocument doc) throws Exception {
        WordExtractor we = new WordExtractor(doc);

        /**
         * Get the total number of paragraphs*
         */
        String[] paragraphs = we.getParagraphText();
        System.out.println("Total Paragraphs: " + paragraphs.length);

        for (int i = 0; i < paragraphs.length; i++) {

            System.out.println("Length of paragraph " + (i + 1) + ": " + paragraphs[i].length());
            System.out.println("----------DOC FILE ddaay ne----------" + paragraphs[i].toString());
            SessionProvider.setSessionMapValue("laodong", paragraphs[i].toString());
            System.out.println("----------DOC FILE ddaay ne-----aaaaaaaaaaaaa-----" + SessionProvider.getSessionMapValue("laodong"));
        }

    }

    public static void readHeader(HWPFDocument doc, int pageNumber) {
        HeaderStories headerStore = new HeaderStories(doc);
        String header = headerStore.getHeader(pageNumber);
        System.out.println("Header Is: " + header);

    }

    public static void readFooter(HWPFDocument doc, int pageNumber) {
        HeaderStories headerStore = new HeaderStories(doc);
        String footer = headerStore.getFooter(pageNumber);
        System.out.println("Footer Is: " + footer);

    }

    public static void readDocumentSummary(HWPFDocument doc) {
        DocumentSummaryInformation summaryInfo = doc.getDocumentSummaryInformation();
        String category = summaryInfo.getCategory();
        String company = summaryInfo.getCompany();
        int lineCount = summaryInfo.getLineCount();
        int sectionCount = summaryInfo.getSectionCount();
        int slideCount = summaryInfo.getSlideCount();

        System.out.println("---------------------------");
        System.out.println("Category: " + category);
        System.out.println("Company: " + company);
        System.out.println("Line Count: " + lineCount);
        System.out.println("Section Count: " + sectionCount);
        System.out.println("Slide Count: " + slideCount);

    }

    /**
     * @return the readFile
     */
    public String getReadFile() {

        return SessionProvider.getSessionMapValue("laodong").toString();
    }

    /**
     * @param readFile the readFile to set
     */
    public void setReadFile(String readFile) {
        this.readFile = readFile;
    }
    
    public static void main(String[] args) throws IOException {
        XWPFDocument document = new XWPFDocument();

        XWPFParagraph paragraphOne = document.createParagraph();
        XWPFParagraph paragraphcenter = document.createParagraph();
        XWPFParagraph paragraphright = document.createParagraph();
        paragraphOne.setAlignment(ParagraphAlignment.LEFT);
         paragraphcenter.setAlignment(ParagraphAlignment.CENTER);
          paragraphright.setAlignment(ParagraphAlignment.RIGHT);
//        paragraphOne.setBorderBottom(Borders.SINGLE);
//        paragraphOne.setBorderTop(Borders.SINGLE);
//        paragraphOne.setBorderRight(Borders.SINGLE);
//        paragraphOne.setBorderLeft(Borders.SINGLE);
//        paragraphOne.setBorderBetween(Borders.SINGLE);

        XWPFRun paragraphOneRunOne = paragraphOne.createRun();
        paragraphOneRunOne.setText("CTY TNHH DU HÀNH SÀI GÒN                                            ");
//        XWPFParagraph paragraphcenter12 = document.createParagraph();
//        paragraphcenter12.setAlignment(ParagraphAlignment.RIGHT);
         paragraphOneRunOne.setFontSize(8);
        paragraphOneRunOne.setText("                                                                                                                                                                                    Mẫu số:02TT");
        paragraphOneRunOne.addBreak();
        
        
//        XWPFParagraph paragraphbanhanh = document.createParagraph();
//         paragraphbanhanh.setAlignment(ParagraphAlignment.RIGHT);
           XWPFParagraph paragraphOne133 = document.createParagraph();
         paragraphOne133.setAlignment(ParagraphAlignment.RIGHT);
        XWPFRun paragraphOneRunhanh = paragraphOne.createRun();
        paragraphOneRunhanh.setFontSize(8);
        paragraphOneRunhanh.setText("                                                                                                                                                                  Ban hành theo QĐ số 15/2006QĐBTC");
        paragraphOneRunhanh.addBreak();
        
        
        XWPFRun paragraphOneRunTwo = paragraphcenter.createRun();
        paragraphOneRunTwo.setFontSize(14);
        paragraphOneRunTwo.setBold(true);
        paragraphOneRunTwo.setText("PHIẾU CHI   ");
         paragraphOneRunTwo.setFontSize(12);
          paragraphOneRunTwo.setBold(false);
        paragraphOneRunTwo.setText("Số :   ");     
        paragraphOneRunTwo.addBreak();
        
        
        XWPFRun paragraphOneRunThree = paragraphcenter.createRun();
        paragraphOneRunThree.setText("Ngày    tháng    năm");
        paragraphOneRunThree.addBreak();
         XWPFParagraph paragraphOne1 = document.createParagraph();
         paragraphOne1.setAlignment(ParagraphAlignment.LEFT);
        XWPFRun paragraphOneRunOne1 = paragraphOne1.createRun();
        LineSpacingRule lineSpacingRule = LineSpacingRule.valueOf(1);
        paragraphOneRunOne1.setSubscript(VerticalAlign.BASELINE);
        paragraphOneRunOne1.setText("Họ tên người nhận tiền:");
        paragraphOneRunOne1.addBreak();
         XWPFParagraph paragraphOne2 = document.createParagraph();
         paragraphOne2.setAlignment(ParagraphAlignment.LEFT);
        XWPFRun paragraphOneRunOne2 = paragraphOne2.createRun();
        paragraphOneRunOne2.setText("Địa chỉ:");
        paragraphOneRunOne2.addBreak();
         XWPFParagraph paragraphOne3 = document.createParagraph();
         paragraphOne3.setAlignment(ParagraphAlignment.LEFT);
        XWPFRun paragraphOneRunOne3 = paragraphOne3.createRun();
        paragraphOneRunOne3.setText("Lý do chi:");
        paragraphOneRunOne3.addBreak();
         XWPFParagraph paragraphOne4 = document.createParagraph();
         paragraphOne4.setAlignment(ParagraphAlignment.LEFT);
        XWPFRun paragraphOneRunOne4 = paragraphOne4.createRun();
        paragraphOneRunOne4.setText("Số tiền:                     đồng");
        paragraphOneRunOne4.addBreak();
         XWPFParagraph paragraphOne5 = document.createParagraph();
         paragraphOne5.setAlignment(ParagraphAlignment.LEFT);
        XWPFRun paragraphOneRunOne5 = paragraphOne5.createRun();
        paragraphOneRunOne5.setText("Bằng chữ:");
        paragraphOneRunOne5.addBreak();
         XWPFParagraph paragraphOne6 = document.createParagraph();
         paragraphOne6.setAlignment(ParagraphAlignment.LEFT);
        XWPFRun paragraphOneRunOne6 = paragraphOne6.createRun();
        paragraphOneRunOne6.setText("Kèm theo:                                chứng từ gốc : ");
        paragraphOneRunOne6.addBreak();
         XWPFParagraph paragraphOne7 = document.createParagraph();
         paragraphOne7.setAlignment(ParagraphAlignment.RIGHT);
        XWPFRun paragraphOneRunOne7 = paragraphOne7.createRun();
        paragraphOneRunOne7.setText("Ngày      tháng     năm");
        paragraphOneRunOne7.addBreak();
         XWPFParagraph paragraphOne8 = document.createParagraph();
         paragraphOne8.setAlignment(ParagraphAlignment.CENTER);
        XWPFRun paragraphOneRunOne8 = paragraphOne8.createRun();
        paragraphOneRunOne8.setText("Người lập phiếu     Người nhận tiền    Thủ quỹ    KT Trưởng    Giám đốc");
        paragraphOneRunOne8.addBreak();

        FileOutputStream outStream = null;
        try {
            outStream = new FileOutputStream("D:/Amit.docx");
        } catch (FileNotFoundException e) {
        }

        try {
            document.write(outStream);
            outStream.close();
        } catch (FileNotFoundException e) {
        } catch (IOException e) {
        }
        
        
        
        
        
    }
}
